<template>
  <div class='card'>
      <div class="blue">生成计划</div>

  </div>
</template>

<script>
import moment from "moment";
import uploadImg from "@/components/uploadImg";
export default {
  name: "formList",
  components:{
    uploadImg
  },
  data(){
    return{
      tips:[{key:'HX',value:'河西码头'},{key:'LTG',value:'龙头港'}],
      dataList:{
        sell:[],
        consignor:[],
        cstTrnscomCd:[],
        customer:[],
      },
      /*my_normalizer(node) {
        return {
          id: node.id,
          label: node.label,
          children: node.children,
          isDisabled: '' !== node.children
        };
      },*/
      goods:null,
      goodsType:[],
      goodsList:[],
      per:'',
      planTagList:[
        {key:'PFRE',value:'提重返空',},
        {key:'PERF_WC',value:'提空返重（指定箱号）',},
        {key:'PE_WC',value:'提空箱（指定箱号）',},
        {key:'PF',value:'提重箱',},
        {key:'BOX',value:'装箱',},
        {key:'UNBOX',value:'拆箱',}
      ],
      form:{
        termCode:'HX',
        returnTermcd:'HX',
        opsttm:moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),
        opedtm:moment(new Date()).add(7,"days").format('YYYY-MM-DD HH:mm:ss'),
        plansExt:{
          createUser:'',
          recipient:'',
          billNo:'',
          moveTo:''
        },
        planBulkGoods:{
          receiverName:'',
          morphology:this.keys.includes('form1')?'HWXT_SZH':'HWXT_JZH',
          gtypecd:'',
          planContainerGoods:{},
          gname:'',
          gunit:'',
        },
        planContainerGoods:{
          gcentwg:'',
          gcentpks:''
        },
        isCheck:-1,
        billno:1
      },
    }
  },
  props:{
    showEd:{
      default: () => true
    },
    keys: {
      default: () => []
    },
  },
  watch:{
    keys(){
      //this.form.planBulkGoods.morphology=this.keys.includes('form1')?'HWXT_SZH':'HWXT_JZH'
    },
  },
  created() {
    this.getDateList()
  },
  methods:{
    setFile(res){
      console.log(999)
      console.log(res)
      this.form.planAttachmentList=res
    },
    re(){
      this.$forceUpdate()
    },
    formatToTree(ary, pid) {
      return ary
          .filter((item) =>
              // 如果没有父id（第一次递归的时候）将所有父级查询出来
              // 这里认为 item.parentId === 1 就是最顶层 需要根据业务调整
              pid === undefined ? item.parentType === null : item.parentType === pid
          )
          .map((item) => {
            // 通过父节点ID查询所有子节点
            item.children = this.formatToTree(ary, item.type);
            return item;
          });
    },
    ch(e){
      console.log(e)
      this.goodsList.forEach(item=>{
        if(item.id===e){
          this.form.planBulkGoods.gtypecd=item.type
        }
      })

    },
    getGoods(){
      console.log(88888)
      this.$api.getGoodsType().then(res=>{
        console.log(res.data)
        this.goodsList=res.data
      }).catch()
    },
    getDateList(){
      console.log(localStorage.getItem('userInfo'))
      this.$forceUpdate()
    },
    opsttm(e){
      console.log(e)
      this.form.opsttm=moment(this.form.opsttm).format('YYYY-MM-DD HH:mm:ss')
    },
    cal(){
      this.$emit('cal')
    },
    sub(){
      this.$emit('sub')
    },
    onSubmit(){

    },
  },
}
</script>

<style scoped lang="less">
.sub{
  background: #043AA7;
  border-radius: 4px;
}
.cal{
  background: #F9F7F7;
  color: #666;
  border: 1px solid #EEEEEE;
  border-radius: 4px;
}
.card{
  border-radius: 5px 5px 5px 5px;
  opacity: 1;
  border: 1px solid #D7D7D7;
  .blue{
    height: 50px;
    background: #0F47B8;
    opacity: 1;
    line-height: 50px;
    color: #fff;
    padding-left: 30px;
  }
}
</style>
